package com.bcqn.enums;

public enum UserWorkStatus {
    /**
     * 工作
     */
    WORK(1, "工作"),
    /**
     * 在校
     */
    SCHOOL(2, "在校");

    private final Integer value;
    private final String title;

    UserWorkStatus(Integer value, String title) {
        this.value = value;
        this.title = title;
    }

    public Integer value() {
        return value;
    }

    public Integer getValue() {
        return value;
    }

    public String getTitle() {
        return title;
    }

    public String getTitle(Integer value) {
        return of(value).title;
    }

    public static UserWorkStatus of(final Integer value) {
        for (UserWorkStatus e : UserWorkStatus.values()) {
            if (e.value != null && e.value.equals(value)) {
                return e;
            }
        }
        return null;
    }

    public static UserWorkStatus nameOf(final String title) {
        for (UserWorkStatus e : UserWorkStatus.values()) {
            if (e.title.equals(title.trim())) {
                return e;
            }
        }
        return null;
    }


    @Override
    public String toString() {
        return this.title;
    }
}
